package com.ethink.warehouse.converter;

import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import com.ethink.framework.common.converter.Converter;
import com.ethink.warehouse.api.info.StockOutOrderDetailInfo;
import com.ethink.warehouse.common.entity.StockOutOrderDetail;

/**
 * 仓库出库单明细 Converter转换器
 *
 * @author default
 * @date 2022-12-05
 */
@Component
public class StockOutOrderDetailConverter implements Converter<StockOutOrderDetailInfo, StockOutOrderDetail> {

    @Override
    public StockOutOrderDetail convertTo(StockOutOrderDetailInfo info) {
        if(info == null) {
            return null;
        }
        StockOutOrderDetail entity = new StockOutOrderDetail ();
        BeanUtils.copyProperties(info, entity);
        return entity;
    }

    @Override
    public StockOutOrderDetailInfo convertFrom(StockOutOrderDetail entity) {
        if(entity == null) {
            return null;
        }
        StockOutOrderDetailInfo info = new StockOutOrderDetailInfo();
        BeanUtils.copyProperties(entity, info);
        return info;
    }
}
